import request from '@/utils/request'

export function getClientList(pageNum, pageSize) {
  return request({
    url: '/client/page',
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function searchClientList(pageNum, pageSize, searchObj) {
  return request({
    url: '/client/search',
    method: 'post',
    data: searchObj,
    params: { pageNum, pageSize }
  })
}

export function clientGetById(id) {
  return request({
    url: '/client/getById/' + id,
    method: 'get'
  })
}

export function deleteClientById(id) {
  return request({
    url: '/client/delete/' + id,
    method: 'delete'
  })
}

export function addClient(client) {
  return request({
    url: '/client/add',
    method: 'post',
    data: client
  })
}

export function updateClient(client) {
  return request({
    url: '/client/update',
    method: 'post',
    data: client
  })
}

export function downloadClientModuleFile() {
  return request({
    url: '/client/downloadModuleFile',
    method: 'get',
    responseType: 'blob'
  })
}

export function clientChannelNoPage() {
  return request({
    url: '/client/channel/noPage',
    method: 'get'
  })
}

export function downloadChannelExcelMode() {
  return request({
    url: '/client/channel/downloadMode',
    method: 'get',
    responseType: 'blob'
  })
}

export function clientBusinessNoPage() {
  return request({
    url: '/client/business/noPage',
    method: 'get'
  })
}

export function addChannel(channelParentLevel, channelName) {
  return request({
    url: '/client/channel/addChannel',
    method: 'post',
    params: { channelParentLevel, channelName }
  })
}

export function addBranch(branchParentLevel, branchName) {
  return request({
    url: '/client/channel/addBranch',
    method: 'post',
    params: { branchParentLevel, branchName }
  })
}

export function clientBranchNoPage() {
  return request({
    url: '/client/channel/branchNoPage',
    method: 'get'
  })
}

export function clientRelationNoPage() {
  return request({
    url: '/client/channel/relationNoPage',
    method: 'get'
  })
}
